#!/usr/bin/env python
from astropy.table import Table
import numpy as np
import matplotlib.pyplot as plt
import sys

tab = Table.read(sys.argv[1],format='ipac')
fig,axes = plt.subplots(4,4,figsize=(16,16))
detect = tab['detect'].data
xt = tab['xt'].data
channel = tab['channel'].data
for i in range(16):
    axes[int(i/4),int(i%4)].plot(channel[np.where(detect==i+1)],xt[np.where(detect==i+1)],linestyle='--')
    axes[int(i/4),int(i%4)].axhline(y=0.0001,c='red')
    axes[int(i/4),int(i%4)].scatter(channel[np.where(detect==i+1)],xt[np.where(detect==i+1)],s=20)
fig.savefig("cross.jpg",bbox_inches='tight')
